#ifndef FULLSCREEN_VIDEO_WIDGET_H
#define FULLSCREEN_VIDEO_WIDGET_H

#include <QVideoWidget>
#include "qmediaplayer.h"

class QLabel;

/**
 * @brief a widget that hosts a video playback, with the
 * intelligence to choose the secondary screen, if available.
 *
 * This widget handles its own visibility, according to playing state
 * and video availability of media object.
 */

class FullScreenVideoWidget : public QVideoWidget
{
   Q_OBJECT
public:
   explicit FullScreenVideoWidget(QWidget *parent = 0);

public slots:
   void onStateChanged(QMediaPlayer::State newState);
   void onVideoAvailableChanged(bool available);
   void setCurrentPixmap(const QString & fullPath);
   void setCurrentPixmap(const QPixmap & pixmap);
   /**
    * @brief to be called when a 'media' has changed; it may be
    *  a new picture or another kind of media
    */
   void onMediaChanged();
   void smartShow();

private:
   bool m_videoIsAvailable;
   QMediaPlayer::State m_state;
   QLabel *m_background;

private:
   void updateVisibility();
};

#endif // FULLSCREEN_VIDEO_WIDGET_H
